<?php declare(strict_types=1);
/**
 * @author      xianganyall <xianganyall@gmail.com>
 * @copyright   2023-2025 owner
 **/

namespace Srv\Libs\ConfModel;

final class SmartyConf extends ConfAbstract
{
    public const PLUGIN_TYPE_MODIFIER           = 'modifier';           // 插件类型[修饰]
    public const PLUGIN_TYPE_BLOCK              = 'block';              // 插件类型[块操作]
    public const PLUGIN_TYPE_FUNCTION           = 'function';           // 插件类型[函数]
    public const PREFIX                         = 'SMARTY.';            // 配置前缀[必定点结尾]
    protected string $tplPath                   = '';                   // 模板相对目录
    protected string $confPath                  = '';                   // 配置读取目录
    protected string $cplPath                   = '';                   // 编译可写目录
    protected string $cachePath                 = '';                   // 缓存可写目录
    protected string $cacheGroupName            = '';                   // 缓存CACHE组名[空-不启用]
    protected int $cacheTime                    = 0;                    // 缓存时长[秒][0-不缓存]
    protected bool $subPath                     = false;                // 是否启用子目录
    protected bool $debug                       = false;                // 是否启用调试
    protected bool $check                       = false;                // 是否启用检查
    protected string $left                      = '{';                  // 左符号
    protected string $right                     = '}';                  // 右符号
    protected array $class                      = [];                   // 注册Class
    protected array $plugin                     = [];                   // 注册Plugin[modifier/block/{functionName}}]

    /**
     * @param array $confData
     */
    public function __construct(array $confData)
    {
        $this->init($confData);
    }

    /**
     * @return string
     */
    public function getTplPath(): string
    {
        return $this->tplPath;
    }

    /**
     * @return string
     */
    public function getConfPath(): string
    {
        return $this->confPath;
    }

    /**
     * @return string
     */
    public function getCplPath(): string
    {
        return $this->cplPath;
    }

    /**
     * @return string
     */
    public function getCachePath(): string
    {
        return $this->cachePath;
    }

    /**
     * @return string
     */
    public function getCacheGroupName(): string
    {
        return $this->cacheGroupName;
    }

    /**
     * @return int
     */
    public function getCacheTime(): int
    {
        return $this->cacheTime;
    }

    /**
     * @return bool
     */
    public function isSubPath(): bool
    {
        return $this->subPath;
    }

    /**
     * @return bool
     */
    public function isDebug(): bool
    {
        return $this->debug;
    }

    /**
     * @return bool
     */
    public function isCheck(): bool
    {
        return $this->check;
    }

    /**
     * @return string
     */
    public function getLeft(): string
    {
        return $this->left;
    }

    /**
     * @return string
     */
    public function getRight(): string
    {
        return $this->right;
    }

    /**
     * @return array
     */
    public function getClass(): array
    {
        return $this->class;
    }

    /**
     * @return array
     */
    public function getPlugin(): array
    {
        return $this->plugin;
    }
}